541898
@@ -313,11 +313,26 @@
public void close() throws IOException {
         }
     }
 
+    /**
+     * Skips over and discards value bytes of data from this input
+     * stream.
+     *
+     * <p>This implementation may end up skipping over some smaller
+     * number of bytes, possibly 0, if an only if it reaches the end
+     * of the underlying stream.</p>
+     *
+     * <p>The actual number of bytes skipped is returned.</p>
+     *
+     * @param value the number of bytes to be skipped.
+     * @return the actual number of bytes skipped.
+     * @throws IOException - if an I/O error occurs.
+     * @throws IllegalArgumentException - if value is negative.
+     */
     public long skip(long value) throws IOException {
         if (value >= 0) {
             long skipped = 0;
             byte[] b = new byte[1024];
-            while (skipped != value) {
+            while (skipped < value) {
                 long rem = value - skipped;
                 int x = read(b, 0, (int) (b.length > rem ? rem : b.length));
                 if (x == -1) {
